/**
 * 
 */
package com.yi.resources.rest;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import org.springframework.context.annotation.Scope;

import com.amazonaws.util.json.JSONArray;
import com.amazonaws.util.json.JSONException;
import com.amazonaws.util.json.JSONObject;
import com.yi.model.internal.IModelUIConfigApi;
import com.yi.model.objects.ModelUIConfig;

/**
 * @author yilo
 * 
 */
@Path("uiconfig")
@Scope("request")
public class ModelUIConfigResource {

	private IModelUIConfigApi modelUIConfigApi;

	

	@Path("/all/{modelTypeId}")
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public Object getBasicAndExtendModelType(
			@Context final HttpServletRequest request,
			@PathParam("modelTypeId") final int modelTypeId) {
		List<ModelUIConfig> modelTypes = getModelUIConfigApi().list(modelTypeId);
		return modelTypes;
	}

	@Path("/single/{modeltypeid}")
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public Object getModelTypeById(@Context final HttpServletRequest request,
			@PathParam("modeltypeid") final String modelTypeId) {

		ModelUIConfig modelType = getModelUIConfigApi().view(modelTypeId);

		return modelType;

	}

	public IModelUIConfigApi getModelUIConfigApi() {
		return modelUIConfigApi;
	}

	public void setModelUIConfigApi(IModelUIConfigApi modelUIConfigApi) {
		this.modelUIConfigApi = modelUIConfigApi;
	}
}
